<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>登录页面 - 网址推荐</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
<link href="css/backend_index.css" rel="stylesheet">
<style></style>
</head>
  
<body>
	
<div class="row lyear-wrapper" style="background-image: url(images/login-bg-3.jpg); background-size: cover;" id="vue">
  <div class="lyear-login">
    <div class="login-center">
		
      <div class="login-header text-center">
        <a href="index.html"> <img alt="light year admin" src="images/logo-sidebar.png" > </a>
      </div>


        <div class="form-group has-feedback feedback-left">
			<select class="form-control" style="color:#ffe7e7" v-model="userInfo.type" size="1" placeholder="请选择类型">
              <option style="color:#ffe7e7;background-color: #64708a;"
                v-for="item in type"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </option>
            </select>
			<span class="mdi mdi-format-list-bulleted form-control-feedback" aria-hidden="true"></span>
        </div>
	
        <div class="form-group has-feedback feedback-left">
          <input type="text" placeholder="请输入用户名" class="form-control" style="color:#ffe7e7"  v-model="userInfo.username"/>
          <span class="mdi mdi-account form-control-feedback" aria-hidden="true"></span>
        </div>
		
        <div class="form-group has-feedback feedback-left">
          <input type="password" placeholder="请输入密码" class="form-control" style="color:#ffe7e7" v-model="userInfo.password" @keydown.enter="submit"/>
          <span class="mdi mdi-lock form-control-feedback" aria-hidden="true"></span>
        </div>
		
		
        <div class="form-group">
          <button @click="submit" class="btn btn-block btn-primary" type="button" >
			  立即登录
		  </button>
        </div>
		<div class="form-group">
		  <button @click="register" class="btn btn-block btn-primary" type="button" >
			  立即注册
		  </button>
		</div>
    
	
    </div>
  </div>
</div>

<script type="text/javascript" src="js/lightyear.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>

<script type="text/javascript">;</script>

<!--消息提示-->
<script src="js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="js/lightyear.js"></script>

<script type="text/javascript" src="vue/vue.min.js"></script>
<script type="text/javascript" src="vue/axios.min.js"></script>
<script type="text/javascript" src="vue/vue_api.js"></script>
<script type="text/javascript" src="vue/vue_config.js"></script>

<link href="vue/element/index.css" rel="stylesheet">
<script type="text/javascript" src="vue/element/index.js"></script> 
<script>
	new Vue({
		el: '#vue',
		data: {
			userInfo: {},
            type:[
              {"label":"website","value":"website"},
              {"label":"self","value":"self"},
            ]
		},
		created(){
			
		},
		methods: {
			submit(){
				console.log("登录",this.userInfo);
				console.log(rootUrl);
				this.login();
			},
			
			login(){
				fetchDataPost(rootUrl+"loginByType",this.userInfo).then(res=>{
					console.log(res)
					if(res.code === 200){
						console.log(res)
						lightyear.loading('show');
						// 假设ajax提交操作
						setTimeout(function() {
						    lightyear.loading('hide');
							lightyear.url(res.data);
						    lightyear.notify(res.message, 'success', 1000);
						}, 1e3)
					}else{
						lightyear.notify(res.message, 'danger', 3000);
					}
				})
				
			},
			register(){
				fetchDataPost(rootUrl+"register",this.userInfo).then(res=>{
					console.log(res)
					if(res.code === 200){
						lightyear.loading('show');
						// 假设ajax提交操作
						setTimeout(function() {
						    lightyear.loading('hide');
						    lightyear.notify(res.message, 'success', 200);
						}, 1e3)
					}else{
						lightyear.notify(res.message, 'danger', 200);
					}
				})
				
			},
		},
	})
</script>
</body>
</html>